#/usr/bin/python
#-*-<coding=UTF-8>-*-

"""
本例展示了位图按钮的使用
"""

import wx

class Frame(wx.Frame):
    
    def __init__(self):
        wx.Frame.__init__(self,parent=None,id=-1,title="",pos=wx.DefaultPosition,size=wx.DefaultSize)
        panel = wx.Panel(self,-1)
        bmp = wx.Image("filezilla.png",wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        self.button = wx.BitmapButton(panel,-1,bmp,pos=(10,20))
        self.Bind(wx.EVT_BUTTON,self.OnClick,self.button)
        #这句话的作用是什么?
        self.button.SetDefault()
        
        self.button2 = wx.BitmapButton(panel,-1,bmp,pos=(10,20))
        self.Bind(wx.EVT_BUTTON,self.OnClick,self.button2)

    def OnClick(self,event):
        #其实一直没有明白event是如何传递进来的.
        self.Destroy()

if __name__ == "__main__":
    app = wx.PySimpleApp()
    frame = Frame()
    frame.Show()
    app.MainLoop()
